WRITE
Section: MINTLIB LIBRARY FUNCTIONS
(3)
Updated: 3 March 1993
Index
Return to Main Contents
NAME
write - write on a file
SYNOPSIS
#include <unistd.h>
int write(int fildes, const void *buf, unsigned nbyte);
DESCRIPTION
fildes is a file descriptor obtained from a creat, open, dup,
fcntl, or pipe system call.
write attempts to write nbyte bytes from the buffer pointed to by
buf to the file associated with fildes.
When fildes indicates a device, writing always takes place at the
current position. When fildes indicates a file, the actual writing
of data proceeds from the position in the file indicated by the
file pointer. Upon return from write, the file pointer is
incremented by the number of bytes actually written.
If the O_APPEND flag of the file status flags is set, the file
pointer will be set to the end of the file prior to writing.
RETURN VALUES
Upon successful completion the number of bytes actually written
is returned. Otherwise, -1 is returned and errno is set to indicate
the error.
NOTE
The underlying call, Fwrite, takes a long nbyte parameter and
returns a long result. This means that, when 16-bit integers are
used, Fwrite can write over 64 Kb at a time while write cannot.
SEE ALSO
creat(3),
dup(3),
fcntl(3),
lseek(3),
open(3),
pipe(3),
Fwrite(2)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUES
-
- NOTE
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 11:15:03 GMT, June 22, 2025